CookieStore

public interface CookieStore implements ProfileService

A service that allows working with the session and persistent cookies.

Cookies can be stored in the process memory (session cookies) or on the file system (persistent cookies). The service provides access to both the session and persistent cookies.

The persistent cookies are stored in the user data directory. You can configure the user data directory path via the userDataDir method. For example:

Engine engine = Engine.newInstance(EngineOptions.newBuilder(renderingMode)
        .userDataDir(Paths.get("/Users/MyApp/Data"))
.build());

All the changes to the cookie store are made in memory, so when you restart the application you will not see the changes you made with the persistent cookies if you do not invoke the persist method before application exit.

Functions

Link copied to clipboard
public abstract List<Cookie> cookies()
Returns an immutable list of all the cookies available in the cookie store.
public abstract List<Cookie> cookies(String url)
Returns an immutable list of cookies for the given url.
Link copied to clipboard
public abstract void delete(Cookie cookie)
Deletes the given cookie from the cookie store.
Link copied to clipboard
public abstract int deleteAll()
Deletes all the cookies from the cookie store and returns the number of deleted cookies.
Link copied to clipboard
public abstract void persist()
Persists all the changes performed to the cookie store.
Link copied to clipboard
public abstract Profile profile()
Returns the profile of this service.
Link copied to clipboard
public abstract void set(Cookie cookie)
Sets the cookie.